<?php

class Gallery_Block_Categories_Frontend extends Kernel_Block 
{
    
    /**
     * Return template data. 
     *
     * @return  array
     */
    public function getData() 
    {
        $query = '
                SELECT 
                       `id`, 
                       `parent_id`, 
                       `name`, 
                       `url`, 
                       IF(`url` = "' . Application::getRequest()->uri(1) . '", 1, 0) `active`
                  FROM 
                       `photo_categories` 
              ORDER BY 
                       `position` 
            ';
        
        return array('entries' => Kernel_Util_Tree::convert(database::fetchAll($query)));
    }
    
}